package ui;

import service.StudentService;
import service.impl.StudentServiceImpl;

import java.util.Scanner;

import static ui.ManageMenu.showManageMenu;

public class LoginMenu {
    private static final StudentService studentService = new StudentServiceImpl();

    public static void showLoginMenu() {
        System.out.println("--------登录界面--------");
        Scanner scanner = new Scanner(System.in);
        System.out.println("--------输入用户名------");
        String userName = scanner.next();
        System.out.println("--------输入密码--------");
        String userPassword = scanner.next();
        try {
            studentService.login(userName, userPassword);
            System.out.println("--------登录成功--------");
            showManageMenu();
        } catch (Exception e) {
            System.out.println(e.getMessage());
            showLoginMenu();
        }
    }
}
